#ifndef __OPERATIONMODE_HPP__
#define __OPERATIONMODE_HPP__

#include "Algorithm.hpp"
#include "Block.hpp"

/**
 * virtual baseclass for all operation modes
 */
class OperationMode {

	protected:
		Algorithm &system;

	public:
		/**
		 * initializes new operation mode with given encryption/decryption algorithm
		 * @param system encryption/decrypion algorithm that is used by this operation mode
		 */
		OperationMode(Algorithm &system) : system(system) { }

		virtual ~OperationMode() { }

		/**
		 * encrypts given plaintext
		 * @param plaintext
		 * @returns ciphertext
		 */
		virtual Block encrypt(const Block &plaintext) = 0;

		/**
		 * decrypts given ciphertext
		 * @param ciphertext
		 * @returns plaintext
		 */
		virtual Block decrypt(const Block &ciphertext) = 0;
};

#endif

